package com.qfedu.yanglao20admin.orderlist.service.impl;

import com.qfedu.yanglao20.entity.orderlist.OrderList;
import com.qfedu.yanglao20admin.orderlist.dao.OrderListDao;
import com.qfedu.yanglao20admin.orderlist.service.OrderListService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * (OrderList)表服务实现类
 *
 * @author makejava
 * @since 2023-05-02 21:10:09
 */
@Service("orderListService")
public class OrderListServiceImpl implements OrderListService {
    @Resource
    private OrderListDao orderListDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public OrderList queryById(Integer id) {
        return this.orderListDao.queryById(id);
    }

    @Override
    public Page<OrderList> queryByPage(OrderList orderList, PageRequest pageRequest) {
        return null;
    }


    /**
     * 新增数据
     *
     * @param orderList 实例对象
     * @return 实例对象
     */
    @Override
    public OrderList insert(OrderList orderList) {
        this.orderListDao.insert(orderList);
        return orderList;
    }

    /**
     * 修改数据
     *
     * @param orderList 实例对象
     * @return 实例对象
     */
    @Override
    public OrderList update(OrderList orderList) {
        this.orderListDao.update(orderList);
        return this.queryById(orderList.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.orderListDao.deleteById(id) > 0;
    }
}
